Repository navigation
fix: never remove registry rows on runtime inventory changes (1.8.73) - #116
Merged
Merged
Conversation
The Bridge's periodic state reconciliation re-applies a whole inventory snapshot and rebuilds the command catalog asynchronously. Topology- triggered migrations during that window saw a partial inventory and removed command buttons, read-only appliance power binary sensors and more; platforms never re-add an entity they created in the same run, so those stayed gone until the next start (observed every ~30 minutes). Removal (entity rows and orphan device cards) now happens only until one pass has run on a ready inventory at setup. Later passes only repair entity IDs; genuinely removed devices are cleaned up on the next start. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
문제
1.8.72 적용 후 재시작 5분 뒤(2026-11-10 01:21Z) 실행 중에 엔티티 323개가 지워졌습니다(button 287, binary_sensor 5, light 4, update 4, number 12, switch 3). 삭제 시각이 Bridge의
state_sync_watchdog(interval, 약 30분) 로그와 정확히 겹치고, 같은 패턴이 00:20Z·00:51Z에도 있었습니다.observeAdvancedInventorySnapshot(..., { authoritativeWholeSnapshot: true })로 전체 스냅샷을 적용하고buildAdvancedCommandCatalog는void로 비동기 실행합니다._migrate_entity_registry를 다시 돌리고, 그 순간의 불완전한 인벤토리로 판단해 명령 버튼과 읽기 전용 가전 전원 binary_sensor 등을 지웠습니다. 지금 인벤토리에서는 같은 기기에 명령이 있고 읽기 전용 가전으로도 정상 분류됩니다.known집합 때문에 같은 실행 중에는 다시 만들어지지 않아, 다음 재시작까지 사라진 상태로 남았습니다.어느 필드가 정확히 비는지(명령, 기기 종류, presentation 중)는 Bridge 내부 타이밍이라 직접 관측하지 못했습니다.
수정
_migrate_entity_registry(..., allow_removal=True)키워드를 추가했습니다. False면 엔티티 행 삭제와 고아 기기 카드 정리를 건너뛰고 이름 정리만 합니다.allow_removal=False를 씁니다. 정말 사라진 기기는 다음 시작 때 정리됩니다.테스트
test_runtime_inventory_change_never_removes_entities: 수정 전 실패(재조정 후 명령 버튼 삭제), 수정 후 통과합니다. 설정 시점 정리(select.counter_gone)는 계속 지워지는지도 확인합니다.tar관련 2건만 로컬 실패합니다(CI 통과 이력 있음).🤖 Generated with Claude Code